
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>订单中心</title>
		<script src="../js/jquery-3.4.1min.js"></script>
		<link rel="stylesheet" href="../css/bootstrap.min.css">
		<script src="../js/popper.min.js"></script>
		<script src="../js/bootstrap.min.js"></script>
		<script type="text/javascript">
			var eeid;
			var ooid;
			$(function(){

				$("#fafafa").click(function(){
					var content = $("#message-text").val()
					console.log($("#message-text").val())
					$.ajax({
						url:"/assess/addAssess",
						//eid,acontent
						data:{"eid":eeid,"acontent":content,"oid":ooid},
						type:"post",
						dateType:"json",
						success:function (data){
							if(data.code==200){
								$("#updateIng").empty();
								$("#updateIng").append("<a href='/assess/goList' class='card-link'>评价成功，点击刷新！</a>");
							}else{
								alert('修改失败')
							}
						}
					})
				})
			})
			function fun(oid,eid) {
				console.log(1111)
				console.log(eid)
				console.log(oid)
				eeid=eid
				ooid=oid
			}
		</script>
	</head>
	<body>
	<div class="container">
			<table class="table">
				<thead>
				<tr>
					<th>订单号</th>
					<th>订单名</th>
					<th>场次</th>
					<th>金额</th>
					<th>有效时间</th>
					<th>下单时间</th>
					<th>数量</th>
					<th>
						操作
					</tr>
				</thead>
				<tbody>

				<c:forEach items="${order1}" var="order" varStatus="status">
				<tr>
					<td>${order.oid}</td>
					<td>${order.ticket.tname}</td>
					<td>${order.ticket.tsession}</td>
					<td>${order.ticket.tmoney}</td>
					<td>
							${order.ticket.t_start_time}至${order.ticket.t_end_time}
<%--						<fmt:formatDate value="${order.ticket.t_start_time}" pattern="yyyy-MM-dd HH:mm:ss"/>至<fmt:formatDate value="${order.ticket.t_end_time}" pattern="yyyy-MM-dd HH:mm:ss"/>--%>
					</td>
					<td>
						<fmt:formatDate value="${order.otime}" pattern="yyyy-MM-dd HH:mm:ss"/>
					</td>
					<td>${order.oquantity}</td>
					<td>
						<c:if test="${order.ostate==3}">
							已验票
							<button type="button" onclick="fun(${order.oid},${order.ticket.eid})" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">添加评论</button>
						</c:if>
						<c:if test="${order.ostate==4}">
							已评价
						</c:if>
						<c:if test="${order.ostate==0}">
							<a href="/order/updateOrderState?oid=${order.oid}" class="btn btn-primary" onclick="return confirm('确认验票?')">验票</a>
							<a href="/order/delOrder?oid=${order.oid}" class="btn btn-primary" onclick="return confirm('确认退票?')">退票</a>
						</c:if>
					</td>
				</tr>
				</c:forEach>
				<tr>
					<td colspan="8" style="text-align: center">
						<a class="btn btn-outline-success" href="/order/getAllOrderByUIdByPage?currentPage=1">首页</a>
						<a class="btn btn-outline-success"class="btn btn-outline-success" href="/order/getAllOrderByUIdByPage?currentPage=${pages.getPrePage()}">上一页</a>
						<c:forEach items="${pages.getPageList()}" var="num">
							<a class="btn btn-outline-success" href="/order/getAllOrderByUIdByPage?currentPage=${num}">${num}</a>
						</c:forEach>
						<a class="btn btn-outline-success" href="/order/getAllOrderByUIdByPage?currentPage=${pages.getNextPage()}">下一页</a>
						<a class="btn btn-outline-success" href="/order/getAllOrderByUIdByPage?currentPage=${pages.getTotalPage()}">尾页</a>
					</td>
				</tr>

				</tbody>
			</table>

	</div>

	<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog" role="document">
			<div class="modal-content" id="updateIng">
				<div class="modal-header">
					<h5 class="modal-title">添加评论</h5>
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
				</div>
				<div class="modal-body">
					<form>
						<div class="form-group">
							<label for="message-text" class="col-form-label">内容:</label>
							<textarea class="form-control" id="message-text"></textarea>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
					<button type="button" id="fafafa"class="btn btn-primary">Send message</button>
				</div>
			</div>
		</div>
	</div>
	</body>
</html>
